#! /bin/sh
# preinst script for libopenxpki-perl
#
# see: dh_installdeb(1)

set -e

case "$1" in
    install)
        COUNT=`grep '^openxpki:' /etc/group | wc -l`;
        if [ $COUNT -eq 0 ]; then
            addgroup --system openxpki;
        fi;
        COUNT=`grep '^openxpki:' /etc/passwd | wc -l`;
        if [ $COUNT -eq 0 ]; then
            adduser --system --no-create-home --disabled-password --disabled-login --ingroup openxpki openxpki;
        fi;
    ;;

    abort-upgrade|abort-remove|abort-deconfigure|upgrade)
    ;;

    *)
        echo "preinst called with unknown argument \`$1'" >&2
        exit 1
    ;;
esac

# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.

#DEBHELPER#

exit 0
